package service

import (
	"guliedu/model"
	"guliedu/repository"
)

type IEduCourseDescriptionService interface {
	Insert(d *model.EduCourseDescription) error
	SelectByCourseID(id string) (*model.EduCourseDescription, error)
	Update(*model.EduCourseDescription) error
	DeleteByCourseID(id string) error
}

func NewIEduCourseDescriptionService() IEduCourseDescriptionService {
	return &EduCourseDescriptionService{EduCourseDescription: repository.NewIEduCourseDescriptionRepository()}
}

type EduCourseDescriptionService struct {
	EduCourseDescription repository.IEduCourseDescriptionRepository
}

func (t *EduCourseDescriptionService) Insert(d *model.EduCourseDescription) error {
	return t.EduCourseDescription.Insert(d)
}

func (t *EduCourseDescriptionService) SelectByCourseID(id string) (*model.EduCourseDescription, error) {
	return t.EduCourseDescription.SelectByCourseID(id)
}

func (t *EduCourseDescriptionService) Update(dsc *model.EduCourseDescription) error {
	return t.EduCourseDescription.Update(dsc)
}

func (t *EduCourseDescriptionService) DeleteByCourseID(id string) error {
	return t.EduCourseDescription.DeleteByCourseID(id)
}
